<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"
                xmlns:pe="http://primefaces.org/ui/extensions">


    <ui:define name="content">

        <h:panelGroup rendered="true" >
            <h:form>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder" header="Casheir Session Report Detail">

                    <f:facet name="header" >

                        <h:outputLabel value="#{commonReport.webUser.institution.name}"/> <br/>


                        <p:commandButton id="btnRefresh" ajax="false" value="Refresh" styleClass="noPrintButton"
                                        actionListener="#{commonReport.recreteModal}" style="float: right;" />  
                        <p:defaultCommand target="btnRefresh"/>
                        
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="reportPrint" />
                        </p:commandButton>  

                        <p:commandButton ajax="false" value="Excel"  styleClass="noPrintButton" style="float: right;" >
                            <pe:exporter type="xlsx" 
                                         target="#{commonReport.userBillsOwn.bills.size() ne 0 ?'billed,':''}
                                         #{commonReport.userCancelledBillsOwn.bills.size() ne 0 ?'cancelled,':''}
                                         #{commonReport.userRefundedBillsOwn.bills.size() ne 0 ?'refund,':''}
                                         #{commonReport.userPaymentBillsOwn.bills.size() ne 0 ?'payment,':''}
                                         #{commonReport.userPaymentCancelBillsOwn.bills.size() ne 0 ?'paymentCancel,':''}
                                         #{commonReport.userPettyPaymentBills.bills.size() ne 0 ?'petty,':''}
                                         #{commonReport.userPettyPaymentCancelBills.bills.size() ne 0 ?'pettyCancel,':''}
                                         #{commonReport.userCashRecieveBills.bills.size() ne 0 ?'companyPay,':''}
                                         #{commonReport.userCashRecieveBillCancel.bills.size() ne 0 ?'companyCancel,':''}
                                         #{commonReport.userAgentRecieveBills.bills.size() ne 0 ?'agent,':''}
                                         #{commonReport.userAgentRecieveBillCancel.bills.size() ne 0 ?'agentCancel,':''}
                                         #{commonReport.userInwardPaymentBillsOwn.bills.size() ne 0 ?'inward,':''}
                                         #{commonReport.userInwardPaymentCancelBillsOwn.bills.size() ne 0 ?'inwardCancel,':''}
                                         sum"  fileName="Cashier_Detailed_Reports_detail"  />
                        </p:commandButton>  

                    </f:facet>


                    <h:panelGrid columns="7" styleClass="noPrintButton" >

                        <h:outputLabel value="From Date"/>
                        <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>

                        <h:outputLabel value="To Date"/>
                        <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                        </p:calendar>
                        <h:outputLabel styleClass="noPrintButton" value="User Name"/>

                        <p:autoComplete converter="webUs" completeMethod="#{webUserController.completeUser}" styleClass="noPrintButton"
                                        forceSelection="true"
                                        var="w" itemLabel="#{w.webUserPerson.name}" itemValue="#{w}"
                                        value="#{commonReport.webUser}" >
                        </p:autoComplete>

                      
                        <h:selectOneMenu value="#{commonReport.billType}">
                            <f:selectItem itemLabel="Select Bill Type"/>
                            <f:selectItems value="#{enumController.cashFlowBillTypes}"/>
                        </h:selectOneMenu>

                    </h:panelGrid>

                    <h:panelGrid columns="7" styleClass="printBlock"  style="min-width: 100%;">

                        <h:outputLabel value="Cashier Detailed Report &nbsp;&nbsp; #{commonReport.webUser.webUserPerson.name}"/>
                        <p:spacer width="200" height="0"/>

                        <h:outputLabel value="From"  />
                        <h:outputLabel  value="#{commonReport.fromDate}" >
                            <f:convertDateTime pattern="dd MM yyyy"/>
                        </h:outputLabel>
                        <p:spacer width="50" height="0"/>
                        <h:outputLabel value="To" />
                        <h:outputLabel  value="#{commonReport.toDate}" >

                            <f:convertDateTime pattern="dd MM yyyy"/>
                        </h:outputLabel>

                    </h:panelGrid>

                    <p:dataTable id="billed"  value="#{commonReport.userBillsOwn.bills}" stickyHeader="true"  var="b"
                                 rendered="#{commonReport.userBillsOwn.bills.size()!=0and commonReport.billType eq 'OpdBill'}" sortBy="#{b.billType}"  >

                        <f:facet name="header" >  

                            <h:outputLabel value="Cashier Session Detailed Report From " class="noPrintButton"/>                            
                            <h:outputLabel value="#{commonReport.fromDate}" class="noPrintButton">
                                <f:convertDateTime pattern="dd MM yyyy"/>
                            </h:outputLabel>

                            <h:outputLabel value=" To" class="noPrintButton" />
                            <h:outputLabel value="#{commonReport.toDate}" class="noPrintButton">
                                <f:convertDateTime pattern="dd MM yyyy"/>  
                            </h:outputLabel>

                            <br/>

                            <h:outputLabel value="Cashier : " class="noPrintButton"/>
                            <h:outputLabel value="#{commonReport.webUser.webUserPerson.name}" class="noPrintButton"/>                        

                        </f:facet>

                        <p:column headerText="Time"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.createdAt}" >
                                <f:convertDateTime pattern="h:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.insId}"/>
                        </p:column>

                        <p:column headerText="Patient Name" >
                            <f:facet name="header">  
                                <h:outputLabel value="Patient Name"/>
                            </f:facet> 
                            <h:outputLabel value=" #{b.patient.person.nameWithTitle}"/>               
                        </p:column>

                        <p:column headerText="Dis." style=" text-align: right">
                            <f:facet name="header">  
                                <h:outputLabel value="Dis."/>
                            </f:facet> 
                            <h:outputLabel value="#{b.discount}">
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Cash" style=" text-align: right"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00" />
                        </p:column>

                        <p:column headerText="Credit" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Credit"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Credit'}" value="#{b.netTotal}"  >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Credit'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="C Card" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="C Card"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Card'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Card'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Checque" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Checque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Cheque'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Slip" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Slip'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Remark" >
                            <f:facet name="header">  
                                <h:outputLabel value="Remark"/>
                            </f:facet> 
                            <h:outputLabel value="Cancelled. (#{b.cancelledBill.insId})" rendered="#{b.cancelled==true}"/>
                            <h:outputLabel value="Refunded. (#{b.refundedBill.insId})" rendered="#{b.refunded==true}"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="4" style="text-align:left" footerText="Totals:"/>  
                                <p:column  style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column  style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userBillsOwn.credit}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column  style=" text-align: right">  
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userBillsOwn.card}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userBillsOwn.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userBillsOwn.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup>  

                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="cancelled"  
                                 value="#{commonReport.userCancelledBillsOwn.bills}" var="b1"  
                                 rendered="#{userCancelledBillsOwn.bills.size()!=0and commonReport.billType eq 'OpdBill'}" >
                        <f:facet name="header">  
                            <h:outputLabel value="Cancelled"/>
                        </f:facet> 
                        <p:column headerText="Time"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b1.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Cancelled Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Cancelled Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b1.insId}"/>
                        </p:column>

                        <p:column headerText="Billed Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b1.billedBill.insId}" >
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Patient Name" >
                            <f:facet name="header">  
                                <h:outputLabel value="Patient Name"/>
                            </f:facet> 
                            <h:outputLabel value="#{b1.patient.person.nameWithTitle}"/>

                        </p:column>

                        <p:column headerText="Cash"  style=" text-align: right"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b1.paymentMethod=='Cash'}" value="#{b1.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b1.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>
                        <p:column headerText="Credit"  style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Credit"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b1.paymentMethod=='Credit'}" value="#{b1.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b1.paymentMethod!='Credit'}" value="0.00"/>

                        </p:column>
                        <p:column headerText="C Card"  style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="C Card"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b1.paymentMethod=='Card'}" value="#{b1.netTotal}"  >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b1.paymentMethod!='Card'}" value="0.00"/>
                        </p:column>
                        <p:column headerText="Checque" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Checque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b1.paymentMethod=='Cheque'}" value="#{b1.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b1.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Slip" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b1.paymentMethod=='Slip'}" value="#{b1.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b1.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="4" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userCancelledBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCancelledBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCancelledBillsOwn.credit}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCancelledBillsOwn.credit}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCancelledBillsOwn.card}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCancelledBillsOwn.card}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCancelledBillsOwn.cheque}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCancelledBillsOwn.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCancelledBillsOwn.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCancelledBillsOwn.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup>  

                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="refund" value="#{commonReport.userRefundedBillsOwn.bills}" var="b" 
                                 sortBy="#{b.billType}"  rendered="#{commonReport.userRefundedBillsOwn.bills.size()!=0and commonReport.billType eq 'OpdBill'}" >

                        <f:facet name="header">  
                            <h:outputLabel value="Refunded" />
                        </f:facet> 

                        <p:column headerText="Time"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Refunded Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Refunded Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.insId}" ></h:outputLabel>
                        </p:column>

                        <p:column headerText="Billed Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.billedBill.insId}" >
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Patient Name" >
                            <f:facet name="header">  
                                <h:outputLabel value="Patient Name"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.patient.person.nameWithTitle}" >
                            </h:outputLabel>

                        </p:column>

                        <p:column headerText="Cash" style=" text-align: right"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Credit" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Credit"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Credit'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Credit'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="C Card" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="C Card"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Card'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Card'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Checque" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Checque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Cheque'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>

                        <p:column headerText="Slip" style=" text-align: right" >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Slip'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column>

                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="4" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userRefundedBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userRefundedBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userRefundedBillsOwn.credit}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userRefundedBillsOwn.credit}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userRefundedBillsOwn.card}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userRefundedBillsOwn.card}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userRefundedBillsOwn.cheque}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userRefundedBillsOwn.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet> 
                                </p:column>
                                <p:column footerText="#{commonReport.userRefundedBillsOwn.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userRefundedBillsOwn.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>


                            </p:row>  
                        </p:columnGroup>  

                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="payment" value="#{commonReport.userPaymentBillsOwn.bills}" var="b"   sortBy="#{b.billType}"
                                 rendered="#{commonReport.userPaymentBillsOwn.bills.size()!=0 and commonReport.billType eq 'PaymentBill'}" >
                        <f:facet name="header">  
                            <h:outputLabel value="Payments"/>
                        </f:facet> 
                        <p:column headerText="Time" rendered="#{commonReport.fromDate ne commonReport.toDate}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.createdAt}"  >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>                        
                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.insId}"/>
                        </p:column>
                        <p:column headerText="Paid to"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Paid to"/>
                            </f:facet> 
                            <h:outputLabel value="#{b.staff.person.nameWithTitle}"/>
                        </p:column>
                        <p:column headerText="Cash" style=" text-align: right" rendered="#{commonReport.userPaymentBillsOwn.cash!=0.0}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>

                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userPaymentBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPaymentBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet> 
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="paymentCancel" value="#{commonReport.userPaymentCancelBillsOwn.bills}" var="b"  
                                 sortBy="#{b.billType}" rendered="#{commonReport.userPaymentCancelBillsOwn.bills.size()!=0and commonReport.billType eq 'PaymentBill'}" >
                        <f:facet name="header">  
                            <h:outputLabel value="PaymentsCancel" />
                        </f:facet> 
                        <p:column headerText="Time" rendered="#{commonReport.fromDate ne commonReport.toDate}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="PaymentsCancel" />
                            </f:facet>
                            <h:outputLabel value="#{b.createdAt}"  >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id" />
                            </f:facet>
                            <h:outputLabel value="#{b.insId}"/>
                        </p:column>

                        <p:column headerText="For Wich Staff"  >
                            <f:facet name="header">  
                                <h:outputLabel value="For Wich Staff" />
                            </f:facet>
                            <h:outputLabel value="#{b.staff.person.nameWithTitle}"/>

                        </p:column>

                        <p:column headerText="Cash" style=" text-align: right" rendered="#{commonReport.userPaymentCancelBillsOwn.cash!=0.0}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash" />
                            </f:facet>
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>

                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userPaymentCancelBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPaymentCancelBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="petty" value="#{commonReport.userPettyPaymentBills.bills}" var="b4"   sortBy="#{b4.billType}"
                                 rendered="#{commonReport.userPettyPaymentBills.bills.size()!=0and commonReport.billType eq 'PettyCash'}">
                        <f:facet name="header">  
                            <h:outputLabel value="Petty Cash Payment"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; " >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 

                            <h:outputLabel value=" #{b4.insId}"/>
                        </p:column>
                        <p:column headerText="For Whome"  >
                            <f:facet name="header">  
                                <h:outputLabel value="For Whome"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.staff.person.nameWithTitle}" rendered="#{b4.person eq null}"/>
                            <h:outputLabel value="#{b4.person.nameWithTitle}" rendered="#{b4.person ne null}"/>
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b4.paymentMethod=='Cash'}" value="#{b4.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b4.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>    
                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Checque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b4.paymentMethod=='Cheque'}" value="#{b4.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b4.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>    

                        <p:column headerText="Invoice" >
                            <f:facet name="header">  
                                <h:outputLabel value="Invoice"/>
                            </f:facet> 

                            <h:outputLabel value="#{b4.invoiceNumber}"/>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userPettyPaymentBills.cash}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPettyPaymentBills.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userPettyPaymentBills.cheque}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPettyPaymentBills.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>


                    <p:dataTable id="pettyCancel" value="#{commonReport.userPettyPaymentCancelBills.bills}" var="b4" 
                                 sortBy="#{b4.billType}" rendered="#{commonReport.userPettyPaymentCancelBills.bills.size()!=0and commonReport.billType eq 'PettyCash'}" >
                        <f:facet name="header">  
                            <h:outputLabel  value="Petty Cash Payment Cancel"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; " >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>

                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.insId}"/>
                        </p:column>
                        <p:column headerText="For Whome" >
                            <f:facet name="header">  
                                <h:outputLabel value="For Whome"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.staff.person.nameWithTitle}" rendered="#{b4.person eq null}"/>
                            <h:outputLabel value="#{b4.person.nameWithTitle}" rendered="#{b4.person ne null}"/>
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b4.paymentMethod=='Cash'}" value="#{b4.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b4.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>    
                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cheque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b4.paymentMethod=='Cheque'}" value="#{b4.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b4.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>    

                        <p:column headerText="Billed Id"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.billedBill.insId}" >
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Billed Date/Time"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Date/Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b4.billedBill.createdAt}" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userPettyPaymentCancelBills.cash}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPettyPaymentCancelBills.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userPettyPaymentCancelBills.cheque}" style=" text-align: right">     
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userPettyPaymentCancelBills.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="companyPay" value="#{commonReport.userCashRecieveBills.bills}" var="b7"   sortBy="#{b7.billType}"
                                 rendered="#{commonReport.userCashRecieveBills.bills.size()!=0and commonReport.billType eq 'CashRecieveBill'}">
                        <f:facet name="header">  
                            <h:outputLabel value="Credit Company Payment Recieve"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; ">
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.insId}" />
                        </p:column>
                        <p:column headerText="Credit Company"  > 
                            <f:facet name="header">  
                                <h:outputLabel value="Credit Company"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.fromInstitution.name}" />
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cash'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>    
                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cheque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cheque'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column> 
                        <p:column headerText="Slip" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Slip'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column> 


                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userCashRecieveBills.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBills.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCashRecieveBills.cheque}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBills.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCashRecieveBills.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBills.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>


                    <p:dataTable id="companyCancel" value="#{commonReport.userCashRecieveBillCancel.bills}" var="b7"   sortBy="#{b7.billType}" 
                                 rendered="#{commonReport.userCashRecieveBillCancel.bills.size()!=0and commonReport.billType eq 'CashRecieveBill'}">
                        <f:facet name="header">  
                            <h:outputLabel value="Credit Company Payment Cancel"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; " >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.insId}"/>
                        </p:column>
                        <p:column headerText="Credit Company"  >   
                            <f:facet name="header">  
                                <h:outputLabel value="Credit Company"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.fromInstitution.name}" />
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cash'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>   

                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cheque"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cheque'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>    

                        <p:column headerText="Slip" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet> 
                            <h:outputLabel rendered="#{b7.paymentMethod=='Slip'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column>    

                        <p:column headerText="Billed Id" style="" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Id"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.billedBill.insId}" >
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Billed Date/Time" style="" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Date/Time"/>
                            </f:facet> 
                            <h:outputLabel value="#{b7.billedBill.createdAt}" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userCashRecieveBillCancel.cash}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBillCancel.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCashRecieveBillCancel.cheque}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBillCancel.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userCashRecieveBillCancel.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userCashRecieveBillCancel.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup>
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="agent" value="#{commonReport.userAgentRecieveBills.bills}" var="b7"   sortBy="#{b7.billType}"
                                 rendered="#{commonReport.userAgentRecieveBills.bills.size()!=0and commonReport.billType eq 'AgentPaymentReceiveBill'}">
                        <f:facet name="header">  
                            <h:outputLabel value="Agent Payment Recieve"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; ">
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id"  style="">
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.insId}"/>
                        </p:column>
                        <p:column headerText="Agent"  style="">      
                            <f:facet name="header">  
                                <h:outputLabel value="Agent"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.fromInstitution.name}" />
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cash'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>    
                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cheque"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cheque'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column>  
                        <p:column headerText="Slip" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Slip'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column>  

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userAgentRecieveBills.cash}" style=" text-align: right">     
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBills.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userAgentRecieveBills.cheque}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBills.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userAgentRecieveBills.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBills.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>  
                        </p:columnGroup> 

                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="agentCancel"  value="#{commonReport.userAgentRecieveBillCancel.bills}" var="b7"   sortBy="#{b7.billType}" 
                                 rendered="#{commonReport.userAgentRecieveBillCancel.bills.size()!=0and commonReport.billType eq 'AgentPaymentReceiveBill'}">
                        <f:facet name="header">  
                            <h:outputLabel value="Agent Payment Cancel"/>
                        </f:facet> 
                        <p:column headerText="Time" style="width:16%; " >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.createdAt}" >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id"  style="">
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.insId}"/>
                        </p:column>
                        <p:column headerText="Agent"  style=""> 
                            <f:facet name="header">  
                                <h:outputLabel value="Agent"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.fromInstitution.name}" />
                        </p:column>

                        <p:column headerText="Cash" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cash"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cash'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>    

                        <p:column headerText="Cheque" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Cheque"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Cheque'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Cheque'}" value="0.00"/>
                        </p:column> 

                        <p:column headerText="Slip" style="text-align: right;"   >
                            <f:facet name="header">  
                                <h:outputLabel value="Slip"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b7.paymentMethod=='Slip'}" value="#{b7.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b7.paymentMethod!='Slip'}" value="0.00"/>
                        </p:column> 

                        <p:column headerText="Billed Id" style="" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Id"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.billedBill.insId}" >
                            </h:outputLabel>
                        </p:column>
                        <p:column headerText="Billed Date/Time" style="" >
                            <f:facet name="header">  
                                <h:outputLabel value="Billed Date/Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b7.billedBill.createdAt}" >
                                <f:convertDateTime pattern="dd MM yy hh:mm a"/>
                            </h:outputLabel>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="3" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userAgentRecieveBillCancel.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBillCancel.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userAgentRecieveBillCancel.cheque}" style=" text-align: right"> 
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBillCancel.cheque}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                                <p:column footerText="#{commonReport.userAgentRecieveBillCancel.slip}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userAgentRecieveBillCancel.slip}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>                   
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="inward" value="#{commonReport.userInwardPaymentBillsOwn.bills}" var="b"   sortBy="#{b.billType}"
                                 rendered="#{commonReport.userInwardPaymentBillsOwn.bills.size()!=0and commonReport.billType eq 'InwardPaymentBill'}" >
                        <f:facet name="header">  
                            <h:outputLabel value="Inward Payments" />
                        </f:facet> 
                        <p:column headerText="Time" rendered="#{commonReport.fromDate ne commonReport.toDate}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b.createdAt}"  >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>                        
                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b.insId}"/>
                        </p:column>
                        <p:column headerText="Bht No"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel  value="#{b.patientEncounter.bhtNo}"/>
                        </p:column>
                        <p:column headerText="Patient"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b.patient.person.nameWithTitle}"/>
                        </p:column>
                        <p:column headerText="Cash" style=" text-align: right"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>
                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="4" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userInwardPaymentBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userInwardPaymentBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>                   
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="inwardCancel" value="#{commonReport.userInwardPaymentCancelBillsOwn.bills}" var="b"   sortBy="#{b.billType}"
                                 rendered="#{commonReport.userInwardPaymentCancelBillsOwn.bills.size()!=0and commonReport.billType eq 'InwardPaymentBill'}" >
                        <f:facet name="header">  
                            <h:outputLabel value="Inward Payments Cancel"/>
                        </f:facet> 
                        <p:column headerText="Time" rendered="#{commonReport.fromDate ne commonReport.toDate}"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel value="#{b.createdAt}"  >
                                <f:convertDateTime pattern="hh:mm a"/>
                            </h:outputLabel>
                        </p:column>

                        <p:column headerText="Id" >
                            <f:facet name="header">  
                                <h:outputLabel value="Id"/>
                            </f:facet>
                            <h:outputLabel value="#{b.insId}"/>
                        </p:column>

                        <p:column headerText="Bht No"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Bht No"/>
                            </f:facet>
                            <h:outputLabel value="#{b.patientEncounter.bhtNo}"/>
                        </p:column>
                        <p:column headerText="Patient"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Patient"/>
                            </f:facet>
                            <h:outputLabel value="#{b.patient.person.nameWithTitle}"/>
                        </p:column>

                        <p:column headerText="Cash" style=" text-align: right"  >
                            <f:facet name="header">  
                                <h:outputLabel value="Time"/>
                            </f:facet>
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>
                        <p:column exportable="false">
                            <p:selectBooleanCheckbox style="border: black 2px solid;"/>
                        </p:column>

                        <p:columnGroup type="footer">  
                            <p:row>  
                                <p:column colspan="4" style="text-align:left" footerText="Totals:"/>  
                                <p:column footerText="#{commonReport.userInwardPaymentCancelBillsOwn.cash}" style=" text-align: right">
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{commonReport.userInwardPaymentCancelBillsOwn.cash}">
                                            <f:convertNumber pattern="#,##0.00"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>
                            </p:row>                   
                        </p:columnGroup> 
                    </p:dataTable>

                    <p:spacer height="30"/>

                    <p:dataTable id="sum" value="#{commonReport.dataTableDataByType}"  var="i" >
                        <f:facet name="header">
                            Summary
                        </f:facet>
                        <p:column>
                            <h:outputLabel value="#{i.string}"/>
                        </p:column>
                        <p:column style="font-weight: bold;text-align:right;" >
                            <h:outputLabel value="#{i.value}">
                                <f:convertNumber pattern="#,##0.00" />
                            </h:outputLabel>
                        </p:column>
                    </p:dataTable>
                    


                </p:panel>
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
